#include "rgb.h"

void rgb_init(){
//	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
	my_gpioinit_out(RCC_APB2Periph_GPIOB,GPIOB,GPIO_Mode_AF_PP,GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8,GPIO_Speed_50MHz);
	
	tim4_ch1_init(256,140-1);
	tim4_ch2_init(256,140-1);
	tim4_ch3_init(256,140-1);
}

void rgb_set(u8 r,u8 g,u8 b){

	TIM_SetCompare1(TIM4,g);
	TIM_SetCompare2(TIM4,b);
	TIM_SetCompare3(TIM4,r);
}